From 8562c623d317023290ac092dea886a2f1f47810d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 4 Aug 2020 22:23:43 -0400 Subject: [PATCH] Drop GtkAccelLabel We no longer use this widget anywhere. --- docs/reference/gtk/gtk4.types.in | 1 - docs/reference/gtk/images/accel-label.png | Bin 3181 -> 0 bytes docs/reference/gtk/meson.build | 1 - docs/reference/gtk/visual_index.xml | 3 - docs/tools/widgets.c | 22 -- gtk/gtk.h | 1 - gtk/gtkaccelgroup.c | 1 - gtk/gtkaccellabel.c | 430 ---------------------- gtk/gtkaccellabel.h | 79 ---- gtk/gtkaccellabelprivate.h | 39 -- gtk/gtkmodelbutton.c | 1 - gtk/meson.build | 2 - tests/testgtk.c | 100 ----- 13 files changed, 680 deletions(-) delete mode 100644 docs/reference/gtk/images/accel-label.png delete mode 100644 gtk/gtkaccellabel.c delete mode 100644 gtk/gtkaccellabel.h delete mode 100644 gtk/gtkaccellabelprivate.h diff --git a/docs/reference/gtk/gtk4.types.in b/docs/reference/gtk/gtk4.types.in index e9de91ee86..cede3f0619 100644 --- a/docs/reference/gtk/gtk4.types.in +++ b/docs/reference/gtk/gtk4.types.in @@ -2,7 +2,6 @@ #include gtk_about_dialog_get_type -gtk_accel_label_get_type gtk_accessible_get_type gtk_actionable_get_type gtk_action_bar_get_type diff --git a/docs/reference/gtk/images/accel-label.png b/docs/reference/gtk/images/accel-label.png deleted file mode 100644 index 282ba8c024886f70e62fcae88ab1293a67bd89fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3181 zcmds4`8(8K`+rkHmQXQvN?B^M?`skvOV&aoQFgM9-CG}J$%JGHNo1+9W*=K(Ok>T~ zVC-Wb(O?>k<(bd-r|Z@_en4}HDEi-cNPEuHp4r5763p; za{+s%Gc=of*M6Bcoet17v|^%-2qu?!0ALj})VpaFlKXo)-0E$R5Qao?FmH;#Bqf3J zOk7|fMPcza#Lp%sy~DrKmWyhMD6#=QZ+-N0y_Z>ujl3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!lI^SN=2@O$ zZ5gczAfx7UgGl%|@Mw2N3n-&5$#TPy-CrKGv(V03W=40N0!8~uMkv-ZA_a0cRdX0r z)EnS+um8OlYjD3B2P-%s#l@===pyD&Y&N` diff --git a/docs/reference/gtk/meson.build b/docs/reference/gtk/meson.build index c9b63cad64..4e3d979790 100644 --- a/docs/reference/gtk/meson.build +++ b/docs/reference/gtk/meson.build @@ -228,7 +228,6 @@ private_headers = [ images = [ 'images/aboutdialog.png', - 'images/accel-label.png', 'images/action-bar.png', 'images/appchooserbutton.png', 'images/appchooserdialog.png', diff --git a/docs/reference/gtk/visual_index.xml b/docs/reference/gtk/visual_index.xml index 8bc3a4f8e9..6810a60989 100644 --- a/docs/reference/gtk/visual_index.xml +++ b/docs/reference/gtk/visual_index.xml @@ -9,9 +9,6 @@ - - - diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c index 556da8325f..70029ed276 100644 --- a/docs/tools/widgets.c +++ b/docs/tools/widgets.c @@ -294,27 +294,6 @@ create_label (void) return new_widget_info ("label", widget, SMALL); } -static WidgetInfo * -create_accel_label (void) -{ - WidgetInfo *info; - GtkWidget *widget, *box; - - widget = gtk_accel_label_new ("Accel Label"); - gtk_widget_set_size_request (widget, 148, -1); - - box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_box_append (GTK_BOX (box), widget); - - gtk_accel_label_set_accel (GTK_ACCEL_LABEL (widget), GDK_KEY_Q, GDK_CONTROL_MASK); - - add_margin (box); - - info = new_widget_info ("accel-label", box, SMALL); - - return info; -} - static WidgetInfo * create_combo_box_entry (void) { @@ -1534,7 +1513,6 @@ get_all_widgets (void) retval = g_list_prepend (retval, create_stack_switcher ()); retval = g_list_prepend (retval, create_spinner ()); retval = g_list_prepend (retval, create_about_dialog ()); - retval = g_list_prepend (retval, create_accel_label ()); retval = g_list_prepend (retval, create_button ()); retval = g_list_prepend (retval, create_check_button ()); retval = g_list_prepend (retval, create_color_button ()); diff --git a/gtk/gtk.h b/gtk/gtk.h index f30643b1c5..4819d51756 100644 --- a/gtk/gtk.h +++ b/gtk/gtk.h @@ -33,7 +33,6 @@ #include #include -#include #include #include #include diff --git a/gtk/gtkaccelgroup.c b/gtk/gtkaccelgroup.c index f5417dbcd0..c4c2b04730 100644 --- a/gtk/gtkaccelgroup.c +++ b/gtk/gtkaccelgroup.c @@ -28,7 +28,6 @@ #include "gtkaccelgroup.h" #include "gtkaccelgroupprivate.h" -#include "gtkaccellabelprivate.h" #include "gtkintl.h" #include "gtkmarshalers.h" #include "gtkprivate.h" diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c deleted file mode 100644 index fc313b0e15..0000000000 --- a/gtk/gtkaccellabel.c +++ /dev/null @@ -1,430 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * GtkAccelLabel: GtkLabel with accelerator monitoring facilities. - * Copyright (C) 1998 Tim Janik - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -/* - * Modified by the GTK+ Team and others 1997-2001. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -#include "config.h" -#include - -#include "gtklabel.h" -#include "gtkaccellabelprivate.h" -#include "gtkintl.h" -#include "gtkmain.h" -#include "gtkprivate.h" -#include "gtksizerequest.h" -#include "gtkstylecontextprivate.h" -#include "gtkwidgetprivate.h" -#include "gtkcssnodeprivate.h" -#include "gtkcssstylepropertyprivate.h" -#include "gtkboxlayout.h" - -/** - * SECTION:gtkaccellabel - * @Short_description: A label which displays an accelerator key on the right of the text - * @Title: GtkAccelLabel - * @See_also: #GtkAccelGroup - * - * The #GtkAccelLabel is a widget that shows an accelerator next to a description - * of said accelerator, e.g. “Save Document Ctrl+S”. - * It is commonly used in menus to show the keyboard short-cuts for commands. - * - * The accelerator key to display is typically not set explicitly (although it - * can be, with gtk_accel_label_set_accel()). Instead, the #GtkAccelLabel displays - * the accelerators which have been added to a particular widget. This widget is - * set by calling gtk_accel_label_set_accel_widget(). - * - * For example, a menu item may have an accelerator added to emit - * the “activate” signal when the “Ctrl+S” key combination is pressed. - * A #GtkAccelLabel is created and added to the menu item widget, and - * gtk_accel_label_set_accel_widget() is called with the item as the - * second argument. The #GtkAccelLabel will now display “Ctrl+S” after its label. - * - * Note that accel labels are typically set up automatically when menus - * are created. - * - * A #GtkAccelLabel will only display accelerators which have %GTK_ACCEL_VISIBLE - * set (see #GtkAccelFlags). - * A #GtkAccelLabel can display multiple accelerators and even signal names, - * though it is almost always used to display just one accelerator key. - * - * # CSS nodes - * - * |[ - * accellabel - * ├── label - * ╰── accelerator - * ]| - * - * #GtkAccelLabel has a main CSS node with the name accellabel. - * It contains the two child nodes with name label and accelerator. - */ - -enum { - PROP_0, - PROP_LABEL, - PROP_USE_UNDERLINE, - LAST_PROP -}; - -struct _GtkAccelLabel -{ - GtkWidget parent_instance; - - GtkWidget *text_label; - GtkWidget *accel_label; - - guint accel_key; /* manual accel key specification if != 0 */ - GdkModifierType accel_mods; -}; - -struct _GtkAccelLabelClass -{ - GtkWidgetClass parent_class; -}; - -GParamSpec *props[LAST_PROP] = { NULL, }; - -static void gtk_accel_label_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void gtk_accel_label_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void gtk_accel_label_finalize (GObject *object); - -G_DEFINE_TYPE (GtkAccelLabel, gtk_accel_label, GTK_TYPE_WIDGET) - -static void -gtk_accel_label_class_init (GtkAccelLabelClass *class) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (class); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); - - gobject_class->finalize = gtk_accel_label_finalize; - gobject_class->set_property = gtk_accel_label_set_property; - gobject_class->get_property = gtk_accel_label_get_property; - - props[PROP_LABEL] = - g_param_spec_string ("label", - P_("Label"), - P_("The text displayed next to the accelerator"), - "", - GTK_PARAM_READWRITE); - - props[PROP_USE_UNDERLINE] = - g_param_spec_boolean ("use-underline", - P_("Use underline"), - P_("If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key"), - FALSE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); - - g_object_class_install_properties (gobject_class, LAST_PROP, props); - - gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT); - gtk_widget_class_set_css_name (widget_class, I_("accellabel")); -} - -static void -gtk_accel_label_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - GtkAccelLabel *accel_label = GTK_ACCEL_LABEL (object); - - switch (prop_id) - { - case PROP_LABEL: - gtk_accel_label_set_label (accel_label, g_value_get_string (value)); - break; - case PROP_USE_UNDERLINE: - gtk_accel_label_set_use_underline (accel_label, g_value_get_boolean (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gtk_accel_label_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - GtkAccelLabel *accel_label = GTK_ACCEL_LABEL (object); - - switch (prop_id) - { - case PROP_LABEL: - g_value_set_string (value, gtk_accel_label_get_label (accel_label)); - break; - case PROP_USE_UNDERLINE: - g_value_set_boolean (value, gtk_accel_label_get_use_underline (accel_label)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gtk_accel_label_init (GtkAccelLabel *accel_label) -{ - accel_label->text_label = gtk_label_new (""); - gtk_widget_set_hexpand (accel_label->text_label, TRUE); - gtk_label_set_xalign (GTK_LABEL (accel_label->text_label), 0.0f); - accel_label->accel_label = g_object_new (GTK_TYPE_LABEL, - "css-name", "accelerator", - NULL); - gtk_widget_set_parent (accel_label->text_label, GTK_WIDGET (accel_label)); - gtk_widget_set_parent (accel_label->accel_label, GTK_WIDGET (accel_label)); -} - -/** - * gtk_accel_label_new: - * @string: the label string. Must be non-%NULL. - * - * Creates a new #GtkAccelLabel. - * - * Returns: a new #GtkAccelLabel. - */ -GtkWidget * -gtk_accel_label_new (const char *string) -{ - return g_object_new (GTK_TYPE_ACCEL_LABEL, - "label", string, - NULL); -} - -static void -gtk_accel_label_finalize (GObject *object) -{ - GtkAccelLabel *accel_label = GTK_ACCEL_LABEL (object); - - gtk_widget_unparent (accel_label->accel_label); - gtk_widget_unparent (accel_label->text_label); - - G_OBJECT_CLASS (gtk_accel_label_parent_class)->finalize (object); -} - -/** - * gtk_accel_label_get_accel_width: - * @accel_label: a #GtkAccelLabel. - * - * Returns the width needed to display the accelerator key(s). - * This is used by menus to align all of the menu item widgets, - * and shouldn't be needed by applications. - * - * Returns: the width needed to display the accelerator key(s). - */ -guint -gtk_accel_label_get_accel_width (GtkAccelLabel *accel_label) -{ - int min; - - g_return_val_if_fail (GTK_IS_ACCEL_LABEL (accel_label), 0); - - gtk_widget_measure (accel_label->accel_label, GTK_ORIENTATION_HORIZONTAL, -1, - &min, NULL, NULL, NULL); - - return min; -} - -/** - * gtk_accel_label_refetch: - * @accel_label: a #GtkAccelLabel. - * - * Recreates the string representing the accelerator keys. - * This should not be needed since the string is automatically updated whenever - * accelerators are added or removed from the associated widget. - * - * Returns: always returns %FALSE. - */ -gboolean -gtk_accel_label_refetch (GtkAccelLabel *accel_label) -{ - gboolean enable_accels; - char *accel_string = NULL; - - g_return_val_if_fail (GTK_IS_ACCEL_LABEL (accel_label), FALSE); - - g_object_get (gtk_widget_get_settings (GTK_WIDGET (accel_label)), - "gtk-enable-accels", &enable_accels, - NULL); - - if (enable_accels && accel_label->accel_key) - { - gboolean have_accel = FALSE; - guint accel_key; - GdkModifierType accel_mods; - - /* First check for a manual accel set with _set_accel() */ - if (accel_label->accel_key) - { - accel_mods = accel_label->accel_mods; - accel_key = accel_label->accel_key; - have_accel = TRUE; - } - - /* If we found a key using either method, set it */ - if (have_accel) - accel_string = gtk_accelerator_get_label (accel_key, accel_mods); - else - /* Otherwise we have a closure with no key. Show "-/-". */ - accel_string = g_strdup ("-/-"); - } - - if (!accel_string) - accel_string = g_strdup (""); - - gtk_label_set_label (GTK_LABEL (accel_label->accel_label), accel_string); - - g_free (accel_string); - - return FALSE; -} - -/** - * gtk_accel_label_set_accel: - * @accel_label: a #GtkAccelLabel - * @accelerator_key: a keyval, or 0 - * @accelerator_mods: the modifier mask for the accel - * - * Manually sets a keyval and modifier mask as the accelerator rendered - * by @accel_label. - * - * If a keyval and modifier are explicitly set then these values are - * used regardless of any associated accel closure or widget. - * - * Providing an @accelerator_key of 0 removes the manual setting. - */ -void -gtk_accel_label_set_accel (GtkAccelLabel *accel_label, - guint accelerator_key, - GdkModifierType accelerator_mods) -{ - g_return_if_fail (GTK_IS_ACCEL_LABEL (accel_label)); - - accel_label->accel_key = accelerator_key; - accel_label->accel_mods = accelerator_mods; - - gtk_accel_label_refetch (accel_label); -} - -/** - * gtk_accel_label_get_accel: - * @accel_label: a #GtkAccelLabel - * @accelerator_key: (out): return location for the keyval - * @accelerator_mods: (out): return location for the modifier mask - * - * Gets the keyval and modifier mask set with - * gtk_accel_label_set_accel(). - */ -void -gtk_accel_label_get_accel (GtkAccelLabel *accel_label, - guint *accelerator_key, - GdkModifierType *accelerator_mods) -{ - g_return_if_fail (GTK_IS_ACCEL_LABEL (accel_label)); - - *accelerator_key = accel_label->accel_key; - *accelerator_mods = accel_label->accel_mods; -} - -/** - * gtk_accel_label_set_label: - * @accel_label: a #GtkAccelLabel - * @text: The new label text - * - * Sets the label part of the accel label. - * - */ -void -gtk_accel_label_set_label (GtkAccelLabel *accel_label, - const char *text) -{ - g_return_if_fail (GTK_IS_ACCEL_LABEL (accel_label)); - - gtk_label_set_text_with_mnemonic (GTK_LABEL (accel_label->text_label), text); -} - -/** - * gtk_accel_label_get_label: - * @accel_label: a #GtkAccelLabel - * - * Returns the current label, set via gtk_accel_label_set_label() - * - * Returns: (transfer none): @accel_label's label - * - */ -const char * -gtk_accel_label_get_label (GtkAccelLabel *accel_label) -{ - g_return_val_if_fail (GTK_IS_ACCEL_LABEL (accel_label), NULL); - - return gtk_label_get_label (GTK_LABEL (accel_label->text_label)); -} - -/** - * gtk_accel_label_set_use_underline: - * @accel_label: a #GtkAccelLabel - * @setting: Whether to use underlines in the label or not - * - * Controls whether to interpret underscores in the text label of @accel_label - * as mnemonic indicators. See also gtk_label_set_use_underline() - */ -void -gtk_accel_label_set_use_underline (GtkAccelLabel *accel_label, - gboolean setting) -{ - g_return_if_fail (GTK_IS_ACCEL_LABEL (accel_label)); - - if (setting == gtk_label_get_use_underline (GTK_LABEL (accel_label->text_label))) - return; - - gtk_label_set_use_underline (GTK_LABEL (accel_label->text_label), setting); - g_object_notify_by_pspec (G_OBJECT (accel_label), props[PROP_USE_UNDERLINE]); -} - -/** - * gtk_accel_label_get_use_underline: - * @accel_label: a #GtkAccelLabel - * - * Returns whether the accel label interprets underscores in it's - * label property as mnemonic indicators. - * See gtk_accel_label_set_use_underline() and gtk_label_set_use_underline(); - * - * Returns: whether the accel label uses mnemonic underlines - */ -gboolean -gtk_accel_label_get_use_underline (GtkAccelLabel *accel_label) -{ - g_return_val_if_fail (GTK_IS_ACCEL_LABEL (accel_label), FALSE); - - return gtk_label_get_use_underline (GTK_LABEL (accel_label->text_label)); -} diff --git a/gtk/gtkaccellabel.h b/gtk/gtkaccellabel.h deleted file mode 100644 index cf8f0998d0..0000000000 --- a/gtk/gtkaccellabel.h +++ /dev/null @@ -1,79 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * Copyright (C) 1998 Tim Janik - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -/* - * Modified by the GTK+ Team and others 1997-2001. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __GTK_ACCEL_LABEL_H__ -#define __GTK_ACCEL_LABEL_H__ - -#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only can be included directly." -#endif - -#include - -G_BEGIN_DECLS - -#define GTK_TYPE_ACCEL_LABEL (gtk_accel_label_get_type ()) -#define GTK_ACCEL_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ACCEL_LABEL, GtkAccelLabel)) -#define GTK_IS_ACCEL_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ACCEL_LABEL)) - -typedef struct _GtkAccelLabel GtkAccelLabel; - -GDK_AVAILABLE_IN_ALL -GType gtk_accel_label_get_type (void) G_GNUC_CONST; -GDK_AVAILABLE_IN_ALL -GtkWidget *gtk_accel_label_new (const char *string); -GDK_AVAILABLE_IN_ALL -guint gtk_accel_label_get_accel_width (GtkAccelLabel *accel_label); -GDK_AVAILABLE_IN_ALL -gboolean gtk_accel_label_refetch (GtkAccelLabel *accel_label); -GDK_AVAILABLE_IN_ALL -void gtk_accel_label_set_accel (GtkAccelLabel *accel_label, - guint accelerator_key, - GdkModifierType accelerator_mods); -GDK_AVAILABLE_IN_ALL -void gtk_accel_label_get_accel (GtkAccelLabel *accel_label, - guint *accelerator_key, - GdkModifierType *accelerator_mods); - -GDK_AVAILABLE_IN_ALL -void gtk_accel_label_set_label (GtkAccelLabel *accel_label, - const char *text); - -GDK_AVAILABLE_IN_ALL -const char * gtk_accel_label_get_label (GtkAccelLabel *accel_label); - -GDK_AVAILABLE_IN_ALL -void gtk_accel_label_set_use_underline (GtkAccelLabel *accel_label, - gboolean setting); - -GDK_AVAILABLE_IN_ALL -gboolean gtk_accel_label_get_use_underline (GtkAccelLabel *accel_label); - -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAccelLabel, g_object_unref) - -G_END_DECLS - -#endif /* __GTK_ACCEL_LABEL_H__ */ diff --git a/gtk/gtkaccellabelprivate.h b/gtk/gtkaccellabelprivate.h deleted file mode 100644 index 248b2e3800..0000000000 --- a/gtk/gtkaccellabelprivate.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* GTK - The GIMP Toolkit - * Copyright (C) 1998, 2001 Tim Janik - * Copyright (C) Javier Jardón - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#ifndef __GTK_ACCEL_LABEL_PRIVATE_H__ -#define __GTK_ACCEL_LABEL_PRIVATE_H__ - - -#include - -G_BEGIN_DECLS - -#define GTK_ACCEL_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ACCEL_LABEL, GtkAccelLabelClass)) - -typedef struct _GtkAccelLabelClass GtkAccelLabelClass; - -char * _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass, - guint accelerator_key, - GdkModifierType accelerator_mods); - - -G_END_DECLS - -#endif /* __GTK_ACCEL_LABEL_PRIVATE_H__ */ diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c index 815493a994..fad86907d2 100644 --- a/gtk/gtkmodelbutton.c +++ b/gtk/gtkmodelbutton.c @@ -39,7 +39,6 @@ #include "gtkstylecontextprivate.h" #include "gtkbuiltiniconprivate.h" #include "gtksizegroup.h" -#include "gtkaccellabelprivate.h" #include "gtkactionable.h" #include "gtkeventcontrollermotion.h" #include "gtkeventcontrollerkey.h" diff --git a/gtk/meson.build b/gtk/meson.build index bdededeaa8..a2d9272e74 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -151,7 +151,6 @@ gtk_private_sources = files([ gtk_public_sources = files([ 'gtkaboutdialog.c', 'gtkaccelgroup.c', - 'gtkaccellabel.c', 'gtkaccessible.c', 'gtkactionable.c', 'gtkactionbar.c', @@ -441,7 +440,6 @@ gtk_private_type_headers = files([ gtk_public_headers = files([ 'gtkaboutdialog.h', 'gtkaccelgroup.h', - 'gtkaccellabel.h', 'gtkaccessible.h', 'gtkactionable.h', 'gtkactionbar.h', diff --git a/tests/testgtk.c b/tests/testgtk.c index ad06542a8f..49d20714f1 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -1576,105 +1576,6 @@ create_listbox (GtkWidget *widget) gtk_window_destroy (GTK_WINDOW (window)); } - -static GtkWidget * -accel_button_new (const char *text, - const char *accel) -{ - guint keyval; - GdkModifierType modifiers; - GtkWidget *button; - GtkWidget *label; - GtkEventController *controller; - GtkShortcut *shortcut; - - if (!gtk_accelerator_parse (accel, &keyval, &modifiers)) - { - g_assert_not_reached (); - } - - button = gtk_button_new (); - controller = gtk_shortcut_controller_new (); - gtk_shortcut_controller_set_scope (GTK_SHORTCUT_CONTROLLER (controller), GTK_SHORTCUT_SCOPE_GLOBAL); - gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE); - shortcut = gtk_shortcut_new (gtk_keyval_trigger_new (keyval, modifiers), - g_object_ref (gtk_activate_action_get ())); - gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller), shortcut); - gtk_widget_add_controller (button, controller); - - label = gtk_accel_label_new (text); - gtk_accel_label_set_accel (GTK_ACCEL_LABEL (label), keyval, modifiers); - gtk_button_set_child (GTK_BUTTON (button), label); - - return button; -} - -static void -create_key_lookup (GtkWidget *widget) -{ - static GtkWidget *window = NULL; - - if (!window) - { - GtkWidget *box; - GtkWidget *button; - GtkWidget *content_area; - - window = gtk_dialog_new_with_buttons ("Key Lookup", NULL, 0, - "_Close", GTK_RESPONSE_CLOSE, - NULL); - - gtk_window_set_display (GTK_WINDOW (window), - gtk_widget_get_display (widget)); - - /* We have to expand it so the accel labels will draw their labels - */ - gtk_window_set_default_size (GTK_WINDOW (window), 300, -1); - - content_area = gtk_dialog_get_content_area (GTK_DIALOG (window)); - - box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_widget_set_hexpand (box, TRUE); - gtk_widget_set_vexpand (box, TRUE); - gtk_box_append (GTK_BOX (content_area), box); - - button = gtk_button_new_with_mnemonic ("Button 1 (_a)"); - gtk_box_append (GTK_BOX (box), button); - button = gtk_button_new_with_mnemonic ("Button 2 (_A)"); - gtk_box_append (GTK_BOX (box), button); - button = gtk_button_new_with_mnemonic ("Button 3 (_\321\204)"); - gtk_box_append (GTK_BOX (box), button); - button = gtk_button_new_with_mnemonic ("Button 4 (_\320\244)"); - gtk_box_append (GTK_BOX (box), button); - button = gtk_button_new_with_mnemonic ("Button 6 (_b)"); - gtk_box_append (GTK_BOX (box), button); - button = accel_button_new ("Button 7", "b"); - gtk_box_append (GTK_BOX (box), button); - button = accel_button_new ("Button 8", "d"); - gtk_box_append (GTK_BOX (box), button); - button = accel_button_new ("Button 9", "Cyrillic_ve"); - gtk_box_append (GTK_BOX (box), button); - button = gtk_button_new_with_mnemonic ("Button 10 (_1)"); - gtk_box_append (GTK_BOX (box), button); - button = gtk_button_new_with_mnemonic ("Button 11 (_!)"); - gtk_box_append (GTK_BOX (box), button); - button = accel_button_new ("Button 12", "a"); - gtk_box_append (GTK_BOX (box), button); - button = accel_button_new ("Button 13", "a"); - gtk_box_append (GTK_BOX (box), button); - button = accel_button_new ("Button 14", "a"); - gtk_box_append (GTK_BOX (box), button); - - g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); - g_signal_connect (window, "response", G_CALLBACK (gtk_window_destroy), NULL); - - gtk_widget_show (window); - } - else - gtk_window_destroy (GTK_WINDOW (window)); -} - - /* create_modal_window */ @@ -5872,7 +5773,6 @@ struct { { "flipping", create_flipping }, { "font selection", create_font_selection }, { "image", create_image }, - { "key lookup", create_key_lookup }, { "labels", create_labels }, { "listbox", create_listbox }, { "message dialog", create_message_dialog }, -- 2.30.2